<script>
	import COMM from "@/common/common.js";
	import {mapState,mapGetters,mapMutation,mapActions} from "vuex";
	export default {
		globalData:{
			timCnt:0
		},
		computed:{
			...mapState({
				sysInfo:state=>state.sys.sysInfo,
				nowNetType:state=>state.netWork.nowNetType,
				initInfo:state=>state.sys.initInfo,
				locationCity:state=>state.map.locationCity
			})
		},
		methods:{
			...mapActions({
				getNetWorkType:"getNetWorkType",
				listenNetChange:"listenNetChange",
				apiGetUpdateInfo:'apiGetUpdateInfo',
				getNowAppInfo:'getNowAppInfo'
			})
		},
		onLaunch: function() {
			uni.closeSocket()
			// #ifdef H5
			uni.setStorageSync('xinqu',[])
			// #endif
			this.getNowAppInfo()		//获取当前APP配置
			this.getNetWorkType();		//获取网络状态
			this.listenNetChange()		//监听网络状态
			this.$store.dispatch("apiGetInit").then(res=>{console.log(res)})   // 请求后台获取初始化信息
			
			this.$store.dispatch('getLocationCity')
			
			
			/* APP情况下 */
			// #ifdef APP-PLUS
			plus.screen.lockOrientation('portrait-primary'); //锁定屏幕方向
			this.$store.dispatch("listenPush");
			this.$store.dispatch("listenPushTap");
			this.$store.dispatch("getPushId");
			if (!uni.getStorageSync('first')) {
				uni.reLaunch({
					url:"pages/guidePage/guidePage"
				})
			}else{
				if(!uni.getStorageSync("xinqu")){
					uni.reLaunch({
						url:"pages/interest/interest"
					})
				}
			}
			// #endif
			
			
		},
		onShow: function() {
			console.log('App Show')
			// #ifdef APP-PLUS
			this.$store.dispatch("changeRoads");
			// let _now=new Date();
			// this.$store.dispatch("checkActionReporo").then(()=>{
			// 	this.$store.dispatch("getToken").then(()=>{
			// 		if(uni.getStorageSync('lastOpen')){
			// 			let _openTime=_now.getTime() -parseInt(uni.getStorageSync('lastOpen'));
			// 			if(_openTime>86400000){	//超过1天 
			// 				this.$store.dispatch("reportAction",{
			// 					acType:'START_APP'
			// 				})
			// 			}
			// 		}else{
			// 			this.$store.dispatch("reportAction",{
			// 				acType:'ACTIVATE_APP'
			// 			})
			// 		}
					
			// 	})
			// })
			// 检查剪贴板
			// COMM.checkClipboard()
			let _args=plus.runtime.arguments
			if(_args){
				let _cs=_args.split("://")[1];
				if(_cs){
					// 带参跳转
					let _e=COMM.strToObj(_cs)
					if(_e.uid){
						this.$store.commit("parentId",_e.uid)
					}
					if(_e.url){
						this.toPage(_e);
					}
				}
			}
			// #endif
		},
		onHide: function() {
			console.log('App Hide')
			// let _args=plus.runtime.arguments
			// if(_args){
			// 	let _cs=_args.split("://")[1];
			// 	if(_cs){
			// 		this.toPage({
			// 			url:'index'
			// 		})
			// 	}
			// }
		}
	}
</script>

<style  >
	@import url('iconfont/iconfont.css');
	view{
		box-sizing: border-box;
	}
	
	.emptyBox{
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 110upx;
	}
	.emptyBox image{
		width: 220upx;
		height: 220upx;
		margin-bottom: 40upx;
	}
	.emptyBox text{
		font-size: 28upx;
		color: #c3c9d6;
	}
	
	.content{
		padding-left: 28upx;
		padding-right: 28upx;
		
	}
	.pageBack{
		background-color: #f4f4f4;
	}
	
	.rightBtnItem{
		display: flex;
		align-items: center;
		margin-left: 20upx;
	}
	.rightBtnItem .rightIcon {
		font-size: 40upx;
		margin-left: 20upx;
	}
	button:after{
		border: none;
		outline: none;
	}
	.couponTicket{
		display: flex;
		align-items: center;
		border: 4upx solid #fe1739;
		border-radius: 10upx;
		font-size: 28upx;
		color: #fe1739;
		padding: 6upx 20upx;
		position: relative;
		margin: 0 30upx;
		
	}
	.couponTicket .leftCircle{
		display: block;
		width: 20upx;
		height: 20upx;
		border-radius: 50%;
		border: 4upx solid #fe1739;
		position: absolute;
		top: 50%;
		left: 0;
		margin-top: -10upx;
		margin-left: -10upx;
		background-color: #FFFFFF;
		border-bottom: 4upx solid #FFFFFF;
		border-left:  4upx solid #FFFFFF;
		transform: translateX(-4upx) rotate(45deg) ;
	}
	.couponTicket .rightCircle{
		display: block;
		width: 20upx;
		height: 20upx;
		border-radius: 50%;
		border: 4upx solid #fe1739;
		position: absolute;
		top: 50%;
		right: 0;
		margin-top: -10upx;
		margin-right: -10upx;
		background-color: #FFFFFF;
		border-top: 4upx solid #FFFFFF;
		border-right:  4upx solid #FFFFFF;
		transform: translateX(4upx) rotate(45deg) ;
	}
</style>
